import 'phaser'

export default class TitleScene extends Phaser.Scene {
    constructor() {
        super({
            key: 'TitleScene'
        });
    }

    create() {
        this.add.image(374 / 2, 600 / 2, 'background')
        this.add.image(490, 68,'title')
        const hero = this.add.image(this.sys.game.config.width / 2,this.sys.game.config.height - 60,'hero')
        const startButton = this.add.sprite(374 / 2, 500 / 2, 'startButton').setInteractive();
        startButton.on('pointerdown', () => {
            startButton.setTint(0xBDBDBD)
            this.scene.start('GameScene');
        });
        startButton.on('pointerup', () => {
            startButton.clearTint()
        });
        startButton.on('pointerout', () => {
            startButton.clearTint()
        });
        this.tweens.add({
            targets: hero,
            y: 480,
            duration: 500,
            // ease: "Power2",
            yoyo: true,
            loop: -1
        });
    }
}
